<?php
class Impact_View_Helper_Truncate
{
    public function truncate($value, $maxLength, $yada = '...')
    {
        $stringValue = (string) $value;
        $yadaLength  = iconv_strlen($yada);

        if (iconv_strlen($value) > $maxLength - $yadaLength) {
            return iconv_substr($value, 0, $maxLength - $yadaLength) . $yada;
        } else {
            return $value;
        }
    }
}

// vim: sw=4:ts=4:sts=4:et
